package com.butterfly.hotkey.core.model.msg;


import com.butterfly.hotkey.core.model.HotKeyModel;
import com.butterfly.hotkey.core.model.KeyCountModel;
import com.butterfly.hotkey.core.rule.ClientKeyRule;

import java.util.Collection;
import java.util.List;

/**
 * netty通信消息
 *
 * @author butterfly
 */
public class HotKeyMsg {

    /**
     * 应用名
     */
    private String appName;

    /**
     * 消息类型
     */
    private byte msgType;

    /**
     * body，通常用于推送给dashboard
     */
    private String body;

    /**
     * client推送的hotkey
     */
    private Collection<HotKeyModel> hotKeyModels;

    /**
     * 推送key的数量
     */
    private Collection<KeyCountModel> keyCountModels;

    /**
     * key的规则信息
     */
    private List<ClientKeyRule> clientKeyRules;

    public HotKeyMsg(byte messageType) {
        this(messageType, null);
    }

    public HotKeyMsg(byte messageType, String appName) {
        this.appName = appName;
        this.msgType = messageType;
    }

    @Override
    public String toString() {
        return "HotKeyMsg{" +
                ", appName='" + appName + '\'' +
                ", msgType=" + msgType +
                ", body='" + body + '\'' +
                ", hotKeyModels=" + hotKeyModels +
                ", keyCountModels=" + keyCountModels +
                '}';
    }

    public List<ClientKeyRule> getClientKeyRules() {
        return clientKeyRules;
    }

    public void setClientKeyRules(List<ClientKeyRule> clientKeyRules) {
        this.clientKeyRules = clientKeyRules;
    }

    public String getAppName() {
        return appName;
    }

    public void setAppName(String appName) {
        this.appName = appName;
    }

    public byte getMsgType() {
        return msgType;
    }

    public void setMsgType(byte msgType) {
        this.msgType = msgType;
    }

    public String getBody() {
        return body;
    }

    public void setBody(String body) {
        this.body = body;
    }

    public Collection<HotKeyModel> getHotKeyModels() {
        return hotKeyModels;
    }

    public void setHotKeyModels(Collection<HotKeyModel> hotKeyModels) {
        this.hotKeyModels = hotKeyModels;
    }

    public Collection<KeyCountModel> getKeyCountModels() {
        return keyCountModels;
    }

    public void setKeyCountModels(Collection<KeyCountModel> keyCountModels) {
        this.keyCountModels = keyCountModels;
    }
}
